package exo1_1;

public class CompteEpargne extends CompteAvecLimite {

	private final double minimumCredit;
	private final double VersementMinimum;
	private double tauxRemuneration;
	private boolean decouvert;
		

	public CompteEpargne(double plafond, double solde, String nom, double numero, double minimumCredit, double versementMinimum,
			double tauxRemuneration, boolean decouvert) 
	{
		super(plafond, solde, nom, numero);
		this.minimumCredit = minimumCredit;
		this.VersementMinimum = versementMinimum;
		this.tauxRemuneration = tauxRemuneration;
		this.decouvert = false;
	}

	public double getTauxRemuneration() {
		return tauxRemuneration;
	}




	public void setTauxRemuneration(double tauxRemuneration) {
		this.tauxRemuneration = tauxRemuneration;
	}




	public double getMinimumCredit() {
		return minimumCredit;
	}




	public double getVersementMinimum() {
		return VersementMinimum;
	}


	public boolean isDecouvert() {
		return decouvert;
	}




	public void setDecouvert(boolean decouvert) {
		this.decouvert = decouvert;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		long temp;
		temp = Double.doubleToLongBits(VersementMinimum);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		result = prime * result + (decouvert ? 1231 : 1237);
		temp = Double.doubleToLongBits(minimumCredit);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(tauxRemuneration);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CompteEpargne other = (CompteEpargne) obj;
		if (Double.doubleToLongBits(VersementMinimum) != Double
				.doubleToLongBits(other.VersementMinimum))
			return false;
		if (decouvert != other.decouvert)
			return false;
		if (Double.doubleToLongBits(minimumCredit) != Double
				.doubleToLongBits(other.minimumCredit))
			return false;
		if (Double.doubleToLongBits(tauxRemuneration) != Double
				.doubleToLongBits(other.tauxRemuneration))
			return false;
		return true;
	}


	@Override
	public String toString() {
		return "CompteEpargne [minimumCredit=" + minimumCredit
				+ ", VersementMinimum=" + VersementMinimum
				+ ", tauxRemuneration=" + tauxRemuneration + ", decouvert="
				+ decouvert + "]";
	}

}
